package com.yfp.device.controller;

import com.yfp.device.domain.dto.ComboMadeDoneDTO;
import com.yfp.device.domain.vo.MakingPackageVO;
import com.yfp.device.service.MachineComboService;
import com.yfp.device.domain.R;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotNull;
import org.springframework.web.bind.annotation.*;

/**
 *
 * @version 1.0
 * @date 2024-06-18 16:55
 */
@Tag(name = "设备套餐接口")
@RestController
@RequestMapping("")
public class MachineComboController {

    @Resource
    private MachineComboService machineComboService;



    /**
     * 获取制作套餐信息，设备发起二维码取餐
     *
     * @param qrCodeId
     * @return
     */
    @Operation(summary = "获取制作套餐信息，设备发起二维码取餐")
    @GetMapping("/action/qrcode/make/info")
    public R<MakingPackageVO> getMakingPackage(@ApiParam(value = "二维码id") @NotNull(message = "二维码id不能为空") @RequestParam("qrCodeId") String qrCodeId) {
        return machineComboService.getMakingPackage(qrCodeId);
    }


    /**
     * 设备上报套餐制作完成，设备上报二维码取餐完成
     *
     * @param comboMadeDoneDTO
     * @return
     */
    @Operation(summary = "设备上报套餐制作完成，设备上报二维码取餐完成")
    @PutMapping("/action/qrcode/status/taken")
    public R<String> reportPackageMadeDone(@RequestBody ComboMadeDoneDTO comboMadeDoneDTO) {
        return machineComboService.reportPackageMadeDone(comboMadeDoneDTO);
    }

}
